<template>
  <section>
    <el-form label-width="80px">
      <el-form-item label="标题">
        <el-input size="mini" v-model="currOrder.title"></el-input>
      </el-form-item>
      <el-form-item label="类型">
        <el-input size="mini" v-model="currOrder.orderType"></el-input>
      </el-form-item>
      <el-form-item label="明细">
        <order-item :items="currOrder.orderItems" :department="department"></order-item>
      </el-form-item>
      <el-form-item label="">
        <el-button size="mini" :type="currOrder.id?'primary':'success'" @click="confirmBtn">{{currOrder.id?'保存':'新建'}}</el-button>
      </el-form-item>
    </el-form>
  </section>
</template>

<script>
  import orderItem from './orderItem'
  import {mapGetters, mapActions, mapMutations} from 'vuex'
  import DateFormat from '@/common/date-formater'
  import errHandler from '@/assets/errHandler'
  import Vue from 'vue'//后续添加属性，需要vue联动
  export default {
    name: "newOrder",
    components:{orderItem},
    props:['currOrder','department'],
    data() {
      return {
      }
    },
    created(){
      console.log('newOrder-----',this.currOrder)
    },
    computed:{
    },
    watch:{
    },
    mounted() {
    },
    methods: {
      ...mapActions({
        fetch: 'fetch'
      }),
      confirmBtn(){
        let data = {
          title:this.currOrder.title,
          orderType:this.currOrder.orderType,
          departmentId:this.department,
          orderItems:JSON.stringify(this.currOrder.orderItems),
          data:{
            customerId:customerId?customerId:null
          }
        }
        console.log('确认了----',this.currOrder)
        // this.$emit('confirm',this.currOrder)
      }
    }
  }
</script>

<style scoped>

</style>
